// 路由传递加密字符 encodeURIComponent()
//cloud.tencent.com/developer/article/1736258?areaSource=102001.12&traceId=oX2izsnussAowKekhkxK8
// https: this.$router.push({
//   path: '/home',
//   query: {
//     params: JSON.stringify({ name: 'lokka', age: 18 })
//   }
// });

// javaScript 写一个函数
// 将对象 obj = { a: 11, b: { b1: 22, b2:33 }, c: 44, d: { d1:55, d2:66, d3:77 } }
// 转换为
// { a:11, b1: 22, b2: 33, c: 44, d1: 55, d2: 66, d3: 77}

var join = function (arr1, arr2) {
  const combinedArr = [...arr1, ...arr2];
  const merged = {};
  combinedArr.forEach(item => {
    const id = item.id;
    merged[id] = !merged[id] ? { ...item } : { ...merged[id], ...item };
  });
  const joinedArr = Object.values(merged);
  joinedArr.sort((a, b) => a.id - b.id);
  return joinedArr;
};
const arr1 = [
  { id: 1, x: 1 },
  { id: 2, x: 9 }
];
const arr2 = [
  { id: 2, x: 11 },
  { id: 3, x: 5 }
];
// console.log(join(arr1, arr2));


var compactObject = function(obj) {
  if(typeof obj === 'object') {
    for(let i in obj) {
      
    }
  }
    
};
